package com.ikun.hosuserservice.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ikun.common.entity.Convention;

import com.ikun.hosuserservice.mapper.IUserMapper;
import com.ikun.hosuserservice.mapper.UserMapper;
import com.ikun.hosuserservice.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class IUserServiceImpl extends ServiceImpl<IUserMapper, Convention> implements IUserService {

    @Autowired
    private IUserMapper iUserMapper;

    @Override
    public Convention changeOrderStatus(String tradeNo, Integer status) {
        Convention convention = iUserMapper.selectOrderByTradeNo(tradeNo);
        iUserMapper.updateOrderStatus(tradeNo, status);
        convention.setState(status);
        return convention;
    }

    @Override
    public Convention getOrderByTradeNo(String tradeNo) {
        return iUserMapper.selectOrderByTradeNo(tradeNo);
    }

    @Override
    public void saveOrder(Convention convention) {
        iUserMapper.insertOrder(convention);
    }
}
